#ifndef MRUNNER_H
#define MRUNNER_H

#include "node.h"
#include "port.h"
#include "channel.h"

#include "ip/fabrics.h"

typedef struct NodeMRunnerParam
{
    List<int> peer_ids;
} NodeMRunnerParam;

class NodeMRunner : public Node
{
public:
    int reg_pid_filter;
    int reg_peer_id;
    ChannelLoadFabricReceiver * port_chain_in;
    ChannelLoadFabricSender * port_chain_out;
    ChannelLoadFabricReceiver * port_message_in;
    ChannelLoadFabricSender * port_message_out;
    PortOut<bool> * port_halt;

    NodeMRunner(Node *parent, NodeMRunnerParam params);
    NodeTaskList tasks() const override;

    void task_process_passing();
    void task_halt_detection();
};

#endif // MRUNNER_H